package com.springcloud.system.user.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.springcloud.common.entity.Resource;
import com.springcloud.system.user.mapper.ResourceDao;
import com.springcloud.system.user.service.ResourceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author mori
 * @since 2019-11-04
 */
@Service
public class ResourceServiceImpl extends ServiceImpl<ResourceDao, Resource> implements ResourceService {

    @Override
    public Set<Resource> resources() {
        List<Resource> resourceList = baseMapper.selectList(Wrappers.emptyWrapper());
        return new HashSet<>(resourceList);
    }

    @Override
    public Set<Resource> resources(String username) {
        List<Resource> resourceList = baseMapper.selectListByUsername(username);
        return new HashSet<>(resourceList);
    }
}
